<template>
    <div>
        <el-row>
            <el-button type="primary" @click="downloadRandom">随机下载</el-button>
            <!-- <el-button type="success">成功按钮</el-button>
            <el-button type="info">信息按钮</el-button>
            <el-button type="warning">警告按钮</el-button>
            <el-button type="danger">危险按钮</el-button> -->
        </el-row>
    </div>
</template>

<script>
import API from '../plugins/axios'
export default {
    data() {
        return {
            downloadUrl: this.$baseUrl + '/problem/download',
        }
    },
    mounted: function () {


    },
    methods: {
        downloadRandom() {
            // 创建一个新的标签页  
            var newTab = window.open("", "_blank");
            // 在新标签页中加载这个URL  
            newTab.document.location.href = this.downloadUrl;
            var h = this.$createElement;
            this.$message({
                message: h('p', null, [
                    h('span', null, '随机题目 '),
                    h('i', { style: 'color: teal' }, '下载成功')
                ])
            });



        }
    }
}
</script>

<style scoped>
.el-row {
    margin: 20px;
}
</style>